

import 'package:basic_common/app_theme.dart';
import 'package:basic_common/common_exports.dart';
import 'package:basic_profile/chilidview/authinfo/authinfo_controller.dart';
import 'package:basic_widgets/image_widget.dart';
import 'package:basic_widgets/text_widget.dart';

/// 医生认证
class AuthAuthenView extends GetView<AuthInfoController> {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: AppTheme.appBgColor,
      child: SingleChildScrollView(
        physics: AlwaysScrollableScrollPhysics(),
        child: Column(
          children: [
            Container(
              color: Colors.white,
              padding: EdgeInsets.only(bottom: ScreenHelper.height(10)),
              child: Column(
                children: [buildInfoWidget()],
              ),
            ),
          ],
        ),
      ),
    );
  }

  Widget buildInfoWidget() {
    return Column(
      children: [
        norTitle(title: "医生执业证书"),
        buildIdCardImg(
            photo1: controller.doctorInfo!.certLicenseMain ?? '',
            photo2: controller.doctorInfo!.certLicenseSub ?? '',
            assetsImg: 'assets/register/img_zhiye_home.png',
            assetsImg2: 'assets/register/img_zhiye_info.png'),
        norTitle(title: "医生职称证书"),
        buildIdCardImg(
            photo1: controller.doctorInfo!.certTitleMain ?? '',
            photo2: controller.doctorInfo!.certTitleSub ?? '',
              assetsImg: 'assets/register/img_zhicheng_home.png',
            assetsImg2: 'assets/register/img_zhicheng_info.png'),
        // norTitle(title: "医生资质证书"),
        // buildIdCardImg(
        //     photo1: controller.doctorInfo!.certDrqMain ?? '',
        //     photo2: controller.doctorInfo!.certDrqSub ?? '',
        //      assetsImg: 'assets/register/img_zhicheng_home.png',
        //     assetsImg2: 'assets/register/img_zhicheng_info.png'),
        norTitle(title: "工作胸牌"),
        buildIdCardImg(
            photo1: controller.doctorInfo!.certDrqMain ?? '',
            photo2: controller.doctorInfo!.certDrqSub ?? '',
             assetsImg: 'assets/register/img_xiongpai.png',
            assetsImg2: 'assets/register/img_xiongpai.png',
            isShowTwo: false),
      ],
    );
  }

  Widget buildIdCardImg(
      {required String assetsImg,
      required String assetsImg2,
      required String photo1,
      required String photo2,
      bool isShowTwo=true}) {
    return Container(
      width: ScreenHelper.width(300),
      height: ScreenHelper.height(120),
      child: Row(
        children: [
          Expanded(
              child: SizedBox(
                  child: photo1.isEmpty
                      ? Image.asset(
                          assetsImg,
                          width: ScreenHelper.width(122),
                          height: ScreenHelper.height(82),
                          package: "basic_common",
                        )
                      : netWorkImgBox(netPath: photo1))),
          SizedBox(
            width: ScreenHelper.width(15),
          ),
          isShowTwo?
          Expanded(
              child: SizedBox(
                  child: photo2.isEmpty
                      ? Image.asset(
                          assetsImg2,
                          width: ScreenHelper.width(122),
                          height: ScreenHelper.height(82),
                          package: "basic_common",
                        )
                      : netWorkImgBox(netPath: photo2))):SizedBox.shrink()
        ],
      ),
    );
  }
}
